<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        
        ul {
            list-style: none;
        }
        
        .app {
            width: 600px;
            height: 500px;
            background: rgb(236, 236, 236);
            margin: 0 auto;
            border-bottom: 5px solid orange;
            border-radius: 5px;
            box-sizing: border-box;
            margin-top: 30px;
            padding-top: 20px;
        }
        
        .app ul {
            height: 50px;
            display: flex;
            justify-content: space-evenly;
        }
        
        .app ul li {
            width: 100px;
            background: rgb(144, 144, 144);
            display: flex;
            justify-content: center;
            align-items: center;
            border-radius: 5px;
            transition: all .7s ease 0s;
            cursor: pointer;
        }
        
        .app ul li.active {
            background-color: skyblue;
        }
        
        .box {
            width: 520px;
            height: 400px;
            margin: 10px auto;
            background: skyblue;
            overflow: hidden;
            border-radius: 5px;
        }
        
        .box>div {
            width: 520px;
            height: 400px;
            background: rgb(201, 193, 255);
            text-align: center;
            line-height: 400px;
            font-size: 30px;
            font-weight: 500;
            display: none;
        }
        
        .box>div.active {
            display: block;
        }
    </style>
</head>
<body>
    <div class="app">
        <ul>
            <li @click="an(1)" :class="{active: dian === 1}">按钮一</li>
            <li @click="an(2)" :class="{active: dian === 2}">按钮二</li>
            <li @click="an(3)" :class="{active: dian === 3}">按钮三</li>
            <li @click="an(4)" :class="{active: dian === 4}">按钮四</li>
        </ul>
        <div class="box">
            <div :class="{active: dian === 1}">内容一</div>
            <div :class="{active: dian === 2}">内容二</div>
            <div :class="{active: dian === 3}">内容三</div>
            <div :class="{active: dian === 4}">内容四</div>
        </div>
    </div>
    <script src="./vue.js"></script>
    <script>
        const { createApp, ref } = Vue;

        createApp({
            setup() {
                let dian = ref(1);

                function an(num) {
                    dian.value = num;
                }

                return {
                    dian,
                    an
                };
            }
        }).mount('.app');
    </script>
</body>
</html>
